import java.util.Scanner;

class MethodDay1 {
    // 判断是否是回文数
    public boolean judge (String str) {
        int left = 0; //左指针
        int right = str.length() - 1; //右指针
        while (left < right) {
            // 如果前后两个指针遍历的字符不一样就不是回文
            if (str.charAt(left) != str.charAt(right)) {
                return false;
            }
            left++;
            right--;
        }
        return true;
    }

    public int sqrt1(int x) {
        if (x < 2) {
            return x;
        }
        int left = 1;
        int right = x / 2;
        while (left < right) {
            int mid = left + (right + left + 1) / 2;
            int sqrtTemp = x / mid;
            if (mid > sqrtTemp) {
                right = mid - 1;
            } else {
                left = mid;
            }
        }
        return left;
    }

    // 求平方根法1
    public int sqrt (int x) {
        if (x < 2) {
            return x;
        }
        int left = 1;
        int right = x / 2;
        while (left < right) {
            int mid = left + (right - left + 1) / 2;
            int sqrtTemp= x / mid;
            if (mid > sqrtTemp) {
                right = mid - 1;
            } else {
                left = mid;
            }
        }
        return left;
    }

}


public class HomeWorkDay1 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("输入字符串:");
        String str = input.next();
        System.out.println("输入一个整数：");
        int x = input.nextInt();

        MethodDay1 method = new MethodDay1();

        // 测试第一题
        System.out.println(method.judge(str));


        // 测试第二题
        System.out.println(method.sqrt(x));
    }


}
